home *** CD-ROM | disk | FTP | other *** search
- Path: casbah.acns.nwu.edu!muzaffar
- From: muzaffar@casbah.acns.nwu.edu (Usman Muzaffar)
- Newsgroups: comp.lang.c
- Subject: Re: How to make this code portable?
- Date: 3 Mar 1996 10:29:30 GMT
- Organization: Northwestern University, Evanston IL
- Message-ID: <4hbsaa$fmu@news.acns.nwu.edu>
- References: <4h8k9j$78r@habs.ee.ubc.ca>
- NNTP-Posting-Host: casbah.acns.nwu.edu
-
- In article <4h8k9j$78r@habs.ee.ubc.ca>, Ellen Ho <ellenh@ee.ubc.ca> wrote:
- >I am writing a program that I want to compile and run on both a Sun
- >Sparcstation and a PC running OS/2 Warp. On the Sun, I compile the .c
- >files with gcc. On the PC, I am using Visual Age.
- >
- >The program acceptes a list of filenames as command line
- >arguments and does some processing with the list of files.
- >On the Sun, I specify
- >
- > program *.txt
- >
- >and the shell will expand the wildcard into the names of all .txt
- >files in the current working directory. So with a for loop in
- >my C program I can go through each file and process the data.
- >
- >However, on the PC, "*.txt" is passed into my program as
- >command line argument as is. This means that I may have to
- >put in extra operating system dependent logic to expand the wildcard
- >inside my program.
- >
- >Are there other ways to handle this?
-
- I think the best way to approach this is to write a dos batch file
- that reads all .txt files and feeds them to your code. Or, if that's
- not easy, just write a couple of lines of which do it and call that
- as a frontend. Your main code stays untouched.
-
-